<?php


namespace App\Service;

use Hyperf\Di\Annotation\Inject;
use Hyperf\Filesystem\FilesystemFactory;
use Hyperf\HttpServer\Contract\RequestInterface;

class AnnexService
{
    /**
     * @Inject
     * @var FilesystemFactory
     */
    private $fileFactory;

    /**
     * @Inject
     * @var RequestInterface
     */
    private $request;

    public function example(FilesystemFactory $factory)
    {
        $local = $factory->get('local');
        $file = $this->request->file('file');
        $stream = fopen($file->getRealPath(), 'r+');
        $local->writeStream(
            'uploads/'.$file->getClientFilename(),
            $stream
        );
        fclose($stream);
    }

    public function getAnnexList($param){

    }

}